<% layout('/layouts/default.html', {title: '查看评价', libs: ['validate','dataGrid']}){ %>
<script src="${ctxStatic}/jquery-bar-rating/jquery.barrating.min.js"></script>
<link rel="stylesheet" href="${ctxStatic}/jquery-bar-rating/themes/bootstrap-stars.css">
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-trophy"></i> ${text('查看评价')}
			</div>
			<!--<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>-->
		</div>
		<#form:form id="inputForm" model="${appointment}" class="form-horizontal">
		<div class="box-body">
			<div class="form-unit">${text('基本信息')}-${appointment.no}</div>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-3" title="">
							${text('预约人')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-9">
							${appointment.leaguer.name}
						</div>
					</div>
				</div>

				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-3" title="">
							${text('地区')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-9">
							${appointment.area.areaName}
						</div>
					</div>
				</div>

			</div>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-3" title="">
							${text('诊所')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-9">
							${appointment.clinic.name}
						</div>
					</div>
				</div>

				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-3" title="">
							${text('科室')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-9">
							${@DictUtils.getDictLabel('fl_department', appointment.department, '未知')}
						</div>
					</div>
				</div>

			</div>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-3" title="">
							${text('预约日期')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-9">
							${@DateUtils.formatDate(appointment.scheduledTime)}
						</div>
					</div>
				</div>

				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-3" title="">
							${text('上下午')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-9">
							${@DictUtils.getDictLabel('fl_ampm', appointment.ampm, '未知')}
						</div>
					</div>
				</div>

			</div>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-3" title="">
							${text('医生')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-9">
							${appointment.doctor==null?"":appointment.doctor.name}
						</div>
					</div>
				</div>

				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-3" title="">
							${text('时间')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-9">
							${appointment.time}
						</div>
					</div>
				</div>

			</div>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-3" title="">
							${text('理由')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-9">
							${appointment.reason}
						</div>
					</div>
				</div>

				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-3" title="">
							${text('备注信息')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-9">
							${appointment.remarks}
						</div>
					</div>
				</div>
			</div>

			<div class="form-unit">${text('评价')}</div>
			<% for(evaluate in appointment.evaluateList){%>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-3" title="">
							${@DictUtils.getDictLabel('fl_evaluate_type', evaluate.type, '未知')}
						</label>
						<div class="col-sm-9">
							<select class="evaluate" name="rating" autocomplete="off" data-value="${evaluate.score}">
								<option value="1">1</option>
								<option value="2">2</option>
								<option value="3">3</option>
								<option value="4">4</option>
								<option value="5">5</option>
							</select>
						</div>
					</div>
				</div>
			</div>
			<%}%>

			<div class="form-unit">${text('评价明细')}</div>
			<div class="row pb20">
				<div class="col-xs-9 col-xs-offset-1">
					<% if (hasPermi('fl:appointment:evaluateEdit')){ %>
					<button type="button" class="btn btn-sm btn-primary" id="btnAddDetail"><i class="fa fa-check"></i> ${text('追加评论')}</button>
					<% } %>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-9 col-xs-offset-1">
					<table class="table">
						<thead>
						<tr>
							<th>时间</th>
							<th>源</th>
							<th>内容</th>
						</tr>
						</thead>
						<tbody>
						<% for(evaluateDetail in appointment.evaluateDetailList){%>
						<tr>
							<td>${@DateUtils.formatDate(evaluateDetail.createDate)}</td>
							<td>${@DictUtils.getDictLabel('fl_evaluate_source', evaluateDetail.source, '未知')}</td>
							<td>${evaluateDetail.content}</td>
						</tr>
						<%}%>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</#form:form>
</div>
</div>
<% } %>
<style>
	.br-widget{
		padding-top:5px;
	}
</style>
<script>
    $('.evaluate').each(function(){
        var self= $(this),
			val = self.data("value");
        self.barrating({
            theme: 'bootstrap-stars',
            showSelectedRating: false,
            readonly:true,
            initialRating:val
        });
	});
$("#btnAddDetail").unbind("click").click(function(){
    openLayerPage('${ctx}/fl/evaluateDetail/form?appointment.id=${appointment.id}&source=2','追加评论',400,400);
});
</script>
